{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import datetime as dt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "time_now = time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "datetime_now = dt.datetime.now(dt.timezone.utc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "epoch = datetime_now - dt.timedelta(seconds=time_now)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1970-01-01 00:00:00.617128+00:00\n"
     ]
    }
   ],
   "source": [
    "print(epoch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import calendar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "c = calendar.Calendar()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[datetime.date(2019, 1, 28),\n",
       " datetime.date(2019, 1, 29),\n",
       " datetime.date(2019, 1, 30),\n",
       " datetime.date(2019, 1, 31),\n",
       " datetime.date(2019, 2, 1),\n",
       " datetime.date(2019, 2, 2),\n",
       " datetime.date(2019, 2, 3),\n",
       " datetime.date(2019, 2, 4),\n",
       " datetime.date(2019, 2, 5),\n",
       " datetime.date(2019, 2, 6),\n",
       " datetime.date(2019, 2, 7),\n",
       " datetime.date(2019, 2, 8),\n",
       " datetime.date(2019, 2, 9),\n",
       " datetime.date(2019, 2, 10),\n",
       " datetime.date(2019, 2, 11),\n",
       " datetime.date(2019, 2, 12),\n",
       " datetime.date(2019, 2, 13),\n",
       " datetime.date(2019, 2, 14),\n",
       " datetime.date(2019, 2, 15),\n",
       " datetime.date(2019, 2, 16),\n",
       " datetime.date(2019, 2, 17),\n",
       " datetime.date(2019, 2, 18),\n",
       " datetime.date(2019, 2, 19),\n",
       " datetime.date(2019, 2, 20),\n",
       " datetime.date(2019, 2, 21),\n",
       " datetime.date(2019, 2, 22),\n",
       " datetime.date(2019, 2, 23),\n",
       " datetime.date(2019, 2, 24),\n",
       " datetime.date(2019, 2, 25),\n",
       " datetime.date(2019, 2, 26),\n",
       " datetime.date(2019, 2, 27),\n",
       " datetime.date(2019, 2, 28),\n",
       " datetime.date(2019, 3, 1),\n",
       " datetime.date(2019, 3, 2),\n",
       " datetime.date(2019, 3, 3)]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(c.itermonthdates(2019, 2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[datetime.date(2019, 2, 1),\n",
       " datetime.date(2019, 2, 2),\n",
       " datetime.date(2019, 2, 3),\n",
       " datetime.date(2019, 2, 4),\n",
       " datetime.date(2019, 2, 5),\n",
       " datetime.date(2019, 2, 6),\n",
       " datetime.date(2019, 2, 7),\n",
       " datetime.date(2019, 2, 8),\n",
       " datetime.date(2019, 2, 9),\n",
       " datetime.date(2019, 2, 10),\n",
       " datetime.date(2019, 2, 11),\n",
       " datetime.date(2019, 2, 12),\n",
       " datetime.date(2019, 2, 13),\n",
       " datetime.date(2019, 2, 14),\n",
       " datetime.date(2019, 2, 15),\n",
       " datetime.date(2019, 2, 16),\n",
       " datetime.date(2019, 2, 17),\n",
       " datetime.date(2019, 2, 18),\n",
       " datetime.date(2019, 2, 19),\n",
       " datetime.date(2019, 2, 20),\n",
       " datetime.date(2019, 2, 21),\n",
       " datetime.date(2019, 2, 22),\n",
       " datetime.date(2019, 2, 23),\n",
       " datetime.date(2019, 2, 24),\n",
       " datetime.date(2019, 2, 25),\n",
       " datetime.date(2019, 2, 26),\n",
       " datetime.date(2019, 2, 27),\n",
       " datetime.date(2019, 2, 28)]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(d for d in c.itermonthdates(2019, 2) if d.month == 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
